home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 045a / qostb229.zip / VIRTUALI.TEC
Text File  |  1991-12-26  |  16KB  |  319 lines

  1. ID:V1 What is Virtualizing?
  2. Quarterdeck Technical Bulletin #229
  3. by Michael Bolton and Eric Wieling
  4.  
  5. Q. What is virtualizing?
  6. Q. What does "virtualize text and graphics" mean?
  7. Q. What does "writes directly to screen" mean?
  8. Q. How can I tell if my program writes directly to screen?
  9. Q. I've set "Runs in background" to Y.  Why isn't my program running in
  10.    background?
  11.  
  12.  
  13. Q. What is virtualizing?
  14.  
  15. Programs can handle display in three ways in DESQview parlance.  These
  16. are explained in more detail below, but briefly,
  17.  
  18. 1) the "well-behaved" application uses DOS or your system's BIOS
  19.    services to display its information;
  20.  
  21. 2) the "DESQview-aware" program writes directly to the screen when not
  22.    running under DESQview, but writes to a special area of memory (under
  23.    DESQview's control) so that DESQview may properly manage display of
  24.    multiple windows.
  25.  
  26. 3) the "misbehaved" application writes directly to the screen hardware
  27.    with no consideration for DESQview or any other multitasking
  28.    environment.
  29.  
  30. Misbehaved applications present a special problem for most multitasking
  31. environments, in that direct screen-writing can "bleed through" into
  32. foreground windows.   However, on a 386 processor, DESQview 386 (which
  33. is simply DESQview and QEMM running on the same computer) can
  34. "virtualize" misbehaved applications; that is, it can fool these
  35. applications into believing that they have exclusive control of the
  36. screen.  Thus, such applications may be run in background or in a small
  37. window without interfering with the display of other applications.
  38.  
  39. The first thing to know about virtualizing is that, unless you are
  40. working on a 386, 386SX, or i486 machine, AND using DESQview 386,
  41. virtualizing means little to you; anything less than a 386 is not
  42. capable of virtualizing the screen, and only DESQview and QEMM (which
  43. together comprise DESQview 386) provide the memory-mapping services
  44. that allow this trick to be performed.  This is another of the many
  45. compelling reasons to move to a 386 processor if you have not already
  46. done so.  (For the purposes of this discussion, the 80386SX, the 80386
  47. (also known as the 80386DX), and the i486 are equivalent; all provide
  48. the memory-management features of the 386.)
  49.  
  50. Now that we've established that we discuss virtualization only when we
  51. refer to a 386, we should look at the way programs display information
  52. on the screen.
  53.  
  54. From DESQview's perspective, there are two basic types of programs, as
  55. far as display is concerned. The first type of program, the
  56. "well-behaved" program in DESQview parlance, uses DOS or the system's
  57. Basic Input/Output Services (BIOS) to put text on the screen.  The BIOS
  58. gets information from the program, and then puts values into screen
  59. memory addresses; these values are then translated by the display
  60. adapter to show up as the characters that you see on your monitor.
  61. "Well-behaved" applications, then, use resources built into the system
  62. to display information.  To run a program in a small window or in
  63. background, DESQview (without QEMM's help, and on any processor)
  64. intercepts DOS and BIOS calls and places the results into a "virtual
  65. screen."  This is an area of memory, or "buffer," the same size as
  66. screen memory, which, to the application, looks and feels exactly like
  67. the real screen.  The application therefore behaves as it would if it
  68. had the computer all to itself.  The "well- behaved" program believes
  69. that display work has been done, and continues about its business
  70. without complaints.
  71.  
  72. Applications which display Hercules, CGA, EGA, or VGA graphics (and this
  73. includes all programs with graphical user interfaces) normally do not
  74. use the BIOS.  Because of the greater complexity involved in displaying
  75. graphics, such programs do not have the option of writing directly to a
  76. DESQview memory buffer, nor are there BIOS services efficient enough to
  77. allow such programs to run at a satisfactory speed.  These applications
  78. are therefore, by definition, NOT well-behaved and are called
  79. (predictably) "misbehaved" in DESQview parlance.  This type of program
  80. avoids DOS and the BIOS, and puts text or graphics on the screen itself
  81. by writing values directly into screen memory addresses.
  82.  
  83. For text-based applications, writing directly to the screen hardware is
  84. considerably faster than using BIOS calls, so many text applications
  85. write directly to in the interests of speed.  Graphics-oriented BIOS
  86. functions are limited in power and flexibility, and in any case are
  87. unacceptably slow, so graphical applications write directly to the
  88. screen.
  89.  
  90. The DESQview-aware program checks for the presence of DESQview (or
  91. Microsoft Windows, or TopView, an IBM environment with which DESQview is
  92. compatible) and asks for the address of the memory buffer that DESQview
  93. will use to store the program's video information.  The program then
  94. writes directly to DESQview's memory buffer instead of to the video
  95. hardware.  This method produces the same well-governed results as
  96. writing through DOS or the BIOS, and is considerably faster.  This type
  97. of application is called "DESQview-aware."
  98.  
  99. Writing directly to screen memory addresses eliminates the middleman,
  100. but the catch is that direct-to-screen display information cannot be
  101. intercepted and redirected as easily as BIOS calls.  Under anything
  102. other than DESQview-386, such programs will not run smoothly in
  103. background or in a small window.  These programs interact directly with
  104. the display hardware, and will write outside the borders of their
  105. DESQview windows; if allowed to run in background or in a small window,
  106. these programs will "leak" or "bleed" into the display windows of other
  107. programs.  The alternative is to suspend the operation of this type of
  108. program while it is in background, which is DESQview's default method of
  109. managing such programs.  This is quite satisfactory for those who want
  110. to use DESQview as a task-switching environment, but not for those who
  111. desire multitasking. 
  112.  
  113. Happily, the 386 processor, QEMM-386, and DESQview, all working
  114. together, can trap the direct screen writes of misbehaved text or
  115. graphics programs and redirect the output of these applications to
  116. DESQview's video buffers -- also called "virtual screens," since as far
  117. as the application knows, it is writing to the screen.  This process is
  118. called "virtualizing." The advantage of virtualizing is that, under
  119. DESQview 386, misbehaved text programs and even programs using Hercules,
  120. CGA, EGA, or VGA graphics can run comfortably in background or in a
  121. small window.
  122.  
  123.  
  124. Q. What, then, is the difference between "virtualizing text" and
  125.    "virtualizing text AND graphics"?
  126.  
  127. First, memory usage: a memory buffer for a virtualized text screen only
  128. takes up as much memory (in bytes) as there are places to display a
  129. character on the screen. That works out to 80 (columns) X 25 (rows) X 2
  130. bytes per character (one byte for the character, and the other for its
  131. display attribute), for a total of 4000 bytes.  If you want to create a
  132. virtual screen to catch text-based data, you won't pay much of a memory
  133. penalty.  DESQview uses expanded memory to virtualize video output, and
  134. expanded memory can only be allocated in 16K chunks (called "pages").
  135. Consequently, it costs 16K, rather than 4000 bytes, of expanded memory
  136. to virtualize a text program.  If you want to virtualize graphics,
  137. though, you'll need as much as 272K of available expanded memory,
  138. depending on the graphics mode that the program is using.
  139.  
  140. Second, there is a difference in the use of the processor's time.  A
  141. virtualized text program is approximately as fast as a nonvirtualized text
  142. program, but virtualizing graphics does take a heavy toll on the processor. 
  143. Incidentally, when you are running a virtualized program full-screen and in
  144. foreground, DESQview temporarily suspends virtualization and lets the program
  145. write to the real video memory region; in this circumstance, there is
  146. little extra processor overhead.
  147.  
  148. Third, it is worth noting that under DESQview 386, even protected mode
  149. programs, also known as DOS-extended programs, can be multitasked,
  150. thanks to a memory-management specification, coauthored by Quarterdeck,
  151. called the Virtual Control Program Interface (VCPI).  It is possible in
  152. most circumstances to virtualize the text output of a program that runs
  153. in protected mode.  This is because most protected mode programs
  154. actually switch into real mode to write text to the screen.  However,
  155. programs which write graphics directly to the screen while in protected
  156. mode cannot be virtualized, so DESQview 386 will by default halt the
  157. operation of such programs when they are not using the full screen.  A
  158. newer specification for multitasking, the DOS Protected Mode Interface,
  159. will allow virtualization of protected-mode programs; future versions of
  160. DESQview and QEMM are expected to support this specification.
  161.  
  162.  
  163. Q.  How can I tell if my program is writing directly to screen?
  164.  
  165. To tell if an application is writing directly to the video hardware
  166. inside DESQview, make the following changes in the application's Change
  167. a Program menu:
  168.  
  169. 1) Set "Writes text directly to screen" to N;
  170.  
  171. 2) Set "Virtualize text/graphics" to N;
  172.  
  173. 3) On the Advanced Options screen, blank out the following four fields
  174. in the "Window Position" section: Starting Height, Starting Width,
  175. Starting Row, and Starting Column.  Put blanks in these fields, not
  176. zeros.
  177.  
  178. After these changes have been made, open the program. DESQview will
  179. place a small window border on the screen; if the program comes up and
  180. stays within the small window border, it does not write directly to the
  181. screen.  If the program demolishes the window border and takes the full
  182. screen, it is writing directly to the hardware, and should be
  183. virtualized if you wish to run it in background or in a small window.
  184.  
  185. Q. Why doesn't my program STAY in background?  It bleeds through on to
  186. the screen when it's background; even though I've set "Runs in
  187. background" to Y, the information from this program keeps showing up in
  188. the foreground window.
  189.  
  190. If it is an application that writes text or graphics directly to screen,
  191. one reason might be that it is not set up to virtualize.  You can amend
  192. this by
  193.  
  194. 1) selecting Change a Program from the DESQview Open Window
  195.    Menu,
  196.  
  197. 2) selecting the program that you want to change, and
  198.  
  199. 3) on page one of the Change a Program Menu, setting "Virtualize text
  200. and graphics" to Y or T.
  201.  
  202.  
  203. Q.  When should I virtualize both text and graphics?
  204.  
  205. If an application does work which you want to continue while the
  206. program is in background or in a small window, and it is a program
  207. that does this work while displaying graphics, set "Virtualize text
  208. and graphics" to Y.
  209.  
  210. Q. When should I virtualize text only?
  211.  
  212. 1) If you have an application which writes text directly to the screen,
  213. but never uses graphics, set Virtualize to T.  Misbehaved text-based
  214. applications are good candidates for this treatment.
  215.  
  216. 2) If you have an application which does write both text and graphics
  217. directly to the screen, but in which you have no need to run the program
  218. in background while graphics are being displayed, set Virtualize to T. A
  219. good example of this type of program is a word processor or a
  220. spreadsheet which has a graphical element to it (a charting or print
  221. preview module, for example) that you never need to run in background or
  222. in a small window.  Even if you're not virtualizing this type of
  223. program, you can still place your chart or print preview in a small
  224. window -- the program simply halts, while retaining the information on
  225. screen.  You can still use DESQview's screen management to see all the
  226. parts of the screen you like, but the program's operation is suspended
  227. while it's in the small window. Recalculating and printing, since they
  228. usually take place while the screen is in text mode, can typically
  229. continue to run in background in such programs, since the text mode of
  230. the program is being virtualized.
  231.  
  232. 3) If you have an application which writes text in real mode, but writes
  233. graphics to the screen while in protected mode, again set "Virtualize
  234. text and graphics" to T.  Do this because the program can still be
  235. virtualized while it's in text mode, even though it can't be virtualized
  236. while it's displaying graphics.
  237.  
  238. Q. I've done all these things and my program STILL won't run in
  239. background. What's wrong?
  240.  
  241. There are a few possibilities.
  242.  
  243. You may have set "Virtualize Text and Graphics" on Page 1 of the
  244. program's Change a Program Menu to N.
  245.  
  246. Solution: set Virtualize Text and Graphics to Y
  247.  
  248. You may simply be out of memory; when DESQview virtualizes an
  249. application's graphics, it can require up to 272K of free expanded
  250. memory.
  251.  
  252. Solution: make sure that you have enough memory available for
  253. virtualizing.  If you have several applications open, close down one or
  254. more.  You might also want to consider upgrading your system by adding
  255. more memory.
  256.  
  257. DESQview 386 cannot virtualize if you have set the Expanded Memory Page
  258. Frame to 0 with QEMM's FRAME=NONE or FRAMELENGTH=0 parameters.
  259.  
  260. Solution: make sure neither of the above parameters are on the QEMM line
  261. in CONFIG.SYS.
  262.  
  263. Although DESQview can save and restore most video modes, there are a few
  264. that it can't virtualize.
  265.  
  266. Solution: try using a lower resolution for the program in question. Text
  267. mode, sometimes known as "CGA mode" for some programs, is a good place
  268. to start.  "CGA mode" is something of a misnomer, since you'll
  269. actually still get your normal resolution on an EGA or VGA -- the
  270. program just writes to the screen without being in graphics mode.
  271.  
  272. To virtualize graphics, you may need more graphics pages.
  273.  
  274. Solution: on the Advanced Options screen of the Change a Program Menu,
  275. set Graphics Pages to a higher number, such as 2 or 3.
  276.  
  277. You may not have enough Real Alternate Maps to virtualize a large number
  278. of windows.
  279.  
  280. Solution:   QEMM must provide DESQview with a Real Alternate Map for
  281. each virtualized window.  Since QEMM's default number of Real Alternate
  282. Maps is 8, if you are using more than 8 windows, you'll be unable to
  283. virtualize window 9.  Close down an application or two, or specify
  284. MAPS=n on the QEMM line in CONFIG.SYS, where n is a number larger than
  285. 8.  Numbers larger than 20 are unlikely to be helpful.
  286.  
  287. Programs that start as part of a DESQview startup script, and are put
  288. into background by the script, may not virtualize if they change video
  289. modes; when the video mode changes, they will be suspended.
  290.  
  291. Solution: for this type of program, make sure that "Runs in Background"
  292. is set to Y, and is not left blank.
  293.  
  294. A program may be grabbing a hardware interrupt, and may write directly
  295. to screen from inside its hardware interrupt handler.
  296.  
  297. Solution: in this unusual circumstance, use Manifest in TSR mode, and
  298. then load your program.  Look at Manifest's First Meg / Interrupts
  299. screen to determine the software interrupt which corresponds to the
  300. hardware interrupt the program is grabbing.  When you want to run this
  301. program under DESQview, use the DESQview startup parameter /HW:nn:V,
  302. where nn is the number, in hexadecimal, of the software interrupt above.
  303. This will allow DESQview to virtualize screen writes that occur
  304. inside the hardware interrupt handler.
  305.  
  306.  
  307. Finally, it should be noted that DESQview 386 is presently the only
  308. program in existence that will multitask and virtualize misbehaved DOS
  309. applications which use EGA and VGA graphics.  Virtualization is one of
  310. the principal ways by which DESQview can multitask these applications;
  311. understanding the above ideas about virtualization can help you to take
  312. the greatest advantage of DESQview's power.
  313.  
  314. This technical note may be copied and distributed freely as long as it is
  315. distributed in its entirety and it is not distributed for profit.
  316.         Copyright (C) 1991 by Quarterdeck Office Systems
  317.              * * *   E N D   O F   F I L E    * * *
  318.  
  319.